package app.fugema.shop.main.order.adapter;

import android.view.View;

import com.base.common.model.bean.ADInfo;
import com.base.common.view.adapter.ada.SingleRecyclerAdapter;
import com.base.common.view.adapter.connector.BaseViewHolder;
import app.fugema.shop.R;
import app.fugema.shop.databinding.ShoppingDeliveryCheckDetailItemBinding;

public class ShoppingDeliveryCheckDetailAdapter extends SingleRecyclerAdapter<ADInfo, ShoppingDeliveryCheckDetailItemBinding> {

    @Override
    public int getLayoutId() {
        return R.layout.shopping_delivery_check_detail_item;
    }

    @Override
    public void onBindViewHolder(ShoppingDeliveryCheckDetailItemBinding binding, int position, BaseViewHolder viewHolder, ADInfo bean) {
        super.onBindViewHolder(binding, position, viewHolder, bean);
        if (position == 0) {
            binding.vLineTop.setVisibility(View.GONE);
            binding.ivProgress.setImageResource(R.mipmap.ic_progress_button);
        } else {
            binding.vLineTop.setVisibility(View.VISIBLE);
            binding.ivProgress.setImageResource(R.mipmap.ic_progress_button_gray);
        }
        if (viewHolder.getAdapter() != null) {
            if (position == viewHolder.getAdapter().getLastPosition()) {
                binding.vLineBottom.setVisibility(View.GONE);
            } else {
                binding.vLineBottom.setVisibility(View.VISIBLE);
            }
        }

    }
}
